<!DOCTYPE html> 
<html>
<head>
  <title>Pong!</title> 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
  <link href="../pong.css" media="screen, print" rel="stylesheet" type="text/css" /> 
</head> 
 
<body> 

  <div id="sidebar">

    <h2>This is Pong!</h2>

    <ul class='parts'>
      <li><a href='/'>Full Game</a></li>
      <li><a href='/part1'><i>game runner</i> - Part 1</a></li>
      <li><a href='/part2'><i>bouncing ball</i> - Part 2</a></li>
      <li><a href='/part3'><i>game loop</i> - Part 3</a></li>
      <li><a href='/part4'><i>collision detection</i> - Part 4</a></li>
      <li><a href='/part5' class='selected'><i>computer AI</i> - Part 5</a></li>
    </ul>

    <div class='description'>
      <p>
        Adding a simple AI allows us to implement a single player game.
      </p>
      <p>
        Press <b>1</b> for a single player game.<br>
        Press <b>2</b> for a double player game.<br>
        Press <b>0</b> to watch the computer play itself.
      </p>
      <p>
        The AI consists of 2 components, a reaction time, and a prediction
        error. The better the human player is, the faster the reaction time
        and the lower the prediction error.
      </p>
      <p>
        The AI recalculates its prediction every so often (based on its reaction
        time) and every time the ball changes direction when it bounces off a wall
      </p>
      <p>
        Here, when you play against the computer you will see a <span style='color:red'>red</span>
        box indicating the exact point the ball will intercept and a <span style='color:yellow'>yellow</span>
        box indicating where the computer thinks it will be.
      </p> 
    </div>

  </div>

  <canvas id="game">
    <div id="unsupported">
      Sorry, this example cannot be run because your browser does not support the &lt;canvas&gt; element
    </div>
  </canvas>

  <script src="game.js" type="text/javascript"></script> 
  <script src="pong.js" type="text/javascript"></script>
  <script type="text/javascript">
  Game.ready(function() {
    Game.start('game', Pong);
  });
  </script>

</body> 
</html>
